import request from '@/utils/request.js'

// 登录接口
export const userApi = ({ username, password }) => {
  return request({
    url: '/user/login',
    method: 'POST',
    data: {
      username,
      password
    }
  })
}

// 获取租房信息列表
export const homeApi = ({ id }) => {
  return request({
    url: '/houses/' + id,
    method: 'GET',
    params: {
      id: id
    }
  })
}

// 获取热门城市信息

export const hotCityApi = () => {
  return request({
    url: '/area/hot',
    method: 'GET'
  })
}

// 获取房屋查询条件

export const cityRulApi = ({ id }) => {
  return request({
    url: '/houses/condition',
    method: 'GET',
    params: {
      id
    }
  })
}
// 根据条件查询房屋
export const cityListApi = ({ cityId, area, subway, rentType, price, more, roomType, oriented, characteristic, floor, start, end }) => {
  return request({
    url: '/houses',
    method: 'GET',
    params: {
      cityId, area, subway, rentType, price, more, roomType, oriented, characteristic, floor, start, end
    }
  })
}

// 获取子级城市列表
export const sonCity = ({ id }) => {
  return request({
    url: '/houses/condition',
    method: 'GET',
    params: {
      id
    }
  })
}

// 获取子级城市列表
export const quApi = ({ level }) => {
  return request({
    url: '/area/city',
    method: 'GET',
    params: {
      level
    }
  })
}

// 首页轮播图
export const swiperApi = () => {
  return request({
    url: '/home/swiper'
  })
}

// 租房小组
export const groupsApi = () => {
  return request({
    url: '/home/groups',
    params: {
      area: 'AREA%7C88cff55c-aaa4-e2e0'
    }
  })
}
